const { request } = require('@/utils')

export function getChannelAPI() {
  return request({
    url: '/channels',
    method: 'GET',
  })
}

export function createArticleAPI(data) {
  return request({
    url: '/mp/articles?draft=false',
    method: 'POST',
    data,
  })
}

export function getArticleListAPI(params) {
  return request({
    url: '/mp/articles',
    method: 'GET',
    params,
  })
}

export function deleteArticleAPI(target) {
  return request({
    url: `/mp/articles/${target}`,
    method: 'DELETE',
  })
}

export function getArticleAPI(target) {
  return request({
    url: `/mp/articles/${target}`,
    method: 'GET',
  })
}

export function editArticleAPI(target, data) {
  return request({
    url: `/mp/articles/${target}?draft=false`,
    method: 'PUT',
    data,
  })
}
